package com.lobaby.tools.modules.excel.controller;

import com.lobaby.tools.base.controller.BaseController;
import com.lobaby.tools.model.ConsoleResult;
import com.lobaby.tools.modules.excel.service.IExcelService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Administrator
 *         Created by Administrator on 2021/3/1 0001.
 */
@Controller
@RequestMapping("/excel")
public class ExcelController extends BaseController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ExcelController.class);

    @Autowired
    private IExcelService excelService;

    @RequestMapping(value = "/latecount", method = RequestMethod.POST)
    @ResponseBody
    public ConsoleResult lateCount(MultipartFile file) {
        try {
            return excelService.lateCount(file);
        } catch (Exception e) {
            LOGGER.error("", e);
            return ConsoleResult.getErrObj("统计异常！");
        }
    }
}
